(function($) {
	
     var prevWindow;
     var imageList;
     var imgsrc;
     
     $.fn.initPreview = function(images,window,imgSource){
    	    	     	 
    	 imageList = images;
    	 prevWindow = window;    	 
    	 imgsrc = imgSource;
    	 $.fn.setupPrevWindow();
    	     	
     };
    
     $.fn.hidePreview = function(){
    	 $(prevWindow).fadeOut();
    	 $(imgsrc).attr("href",'');
    	 $(imgsrc).text('');

     };
     
     $.fn.setupPrevWindow = function(){
    	 
    	 jQuery.each(imageList, function(index, value) {
 			
 			$(value).mouseenter(function(){ 			
 				$(prevWindow).attr("src",$(value).attr("src"));	
			    $(value).css("-moz-box-shadow","0pt 0pt 5px rgba(0,0,0,0.9)");			    
			    $(prevWindow).fadeIn("fast");
			    
			    $(imgsrc).attr("href",$(value).attr("alt"));
			    $(imgsrc).text("Quoted from " + $(value).attr("alt"));
			    
			    $(prevWindow).parent().fadeIn("slow");
 			}); 

			$(value).mouseleave(function(){ 			
 				$(prevWindow).attr("src",$(value).attr("src"));	
			    $(value).css("-moz-box-shadow","0pt 0pt 5px rgba(0,0,0,0.5)");
			    
			   
 			});			
 			
 	 	});
     };
     
         
})(jQuery);